﻿using System;
using System.Text;
using System.Collections.Generic;
using Demo_G.O.S.E.ServerEngine.Common;
using Demo_G.O.S.E.ServerEngine.Network;
using Demo_G.O.S.E.ServerEngine.Map;
using Demo_G.O.S.E.ServerEngine.Creature;
using System.Diagnostics;

namespace Demo_G.O.S.E.ServerEngine.Item.General
{
    /// <summary>
    /// 
    /// </summary>
    public class GeneralItem : BaseItem
    {
        #region zh-CHS 构造和初始化和清理 | en Constructors and Initializers and Dispose
        /// <summary>
        /// 
        /// </summary>
        public GeneralItem()
            : base()
        {
            //UpdateItem( UpdateBaseItemValue.ItemDelta, new GeneralItemDelta() );
        }

        /// <summary>
        /// 
        /// </summary>
        /// <param name="serial"></param>
        public GeneralItem( Serial serial )
            : base( serial )
        {
            //UpdateItem( UpdateBaseItemValue.ItemDelta, new GeneralItemDelta() );
        }
        #endregion

        #region zh-CHS 道具的GUID | en
        #region zh-CHS 私有成员变量 | en Private Member Variables
        /// <summary>
        /// 
        /// </summary>
        private Serial m_ItemGUID;
        #endregion
        /// <summary>
        /// 道具的ID
        /// </summary>
        [CommandProperty( AccessLevel.GameMaster )]
        public virtual Serial ItemGUID
        {
            get { return m_ItemGUID; }
            set { m_ItemGUID = value; }
        }
        #endregion

        #region zh-CHS 道具/金币/负重-数值的属性 | en Properties

        #region zh-CHS Gold属性 | en Public Properties

        #region zh-CHS 私有成员变量 | en Private Member Variables
        /// <summary>
        /// 
        /// </summary>
        private long m_Gold = 0;
        #endregion
        /// <summary>
        /// 道具总价值的金币
        /// </summary>
        [CommandProperty( AccessLevel.GameMaster )]
        public long Gold
        {
            get { return m_Gold; }
            set { UpdateGold( value ); }
        }

        #region zh-CHS 保护方法 | en Protected Methods
        /// <summary>
        /// 金币改变时调用
        /// </summary>
        public virtual bool OnGoldChange( long newValue )
        {
            return true;
        }

        /// <summary>
        /// 金币改变时后调用
        /// </summary>
        public virtual void OnAfterGoldChange( long oldValue )
        {
        }
        #endregion

        #region zh-CHS 共有方法 | en Public Methods
        /// <summary>
        /// 更新全部类型的数量
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="type"></param>
        /// <param name="delta"></param>
        public bool UpdateGold( long newValue )
        {
            if ( newValue < 0 )
                return false;

            long oldValue = m_Gold;

            if ( OnGoldChange( newValue ) == false )
                return false;
            else
                m_Gold = newValue;

            GeneralItemDelta l_ItemDelta = ItemDelta as GeneralItemDelta;
            if ( l_ItemDelta == null )
                Debug.WriteLine( "GeneralMobile.UpdateGold(...) - l_ItemDelta == null warning!" );
            else
            {
                l_ItemDelta.DeltaGoldUpdate();
                UpdateSlice();
            }

            OnAfterGoldChange( oldValue );

            return true;
        }
        #endregion

        #endregion

        #region zh-CHS Weight属性 | en Public Properties

        #region zh-CHS 私有成员变量 | en Private Member Variables
        /// <summary>
        /// 
        /// </summary>
        private long m_Weight = 0;
        #endregion
        /// <summary>
        /// 道具的重量
        /// </summary>
        [CommandProperty( AccessLevel.Counselor, AccessLevel.GameMaster )]
        public long Weight
        {
            get { return m_Weight; }
            set { UpdateWeight( value ); }
        }

        #region zh-CHS 保护方法 | en Protected Methods
        /// <summary>
        /// 金币改变时调用
        /// </summary>
        public virtual bool OnWeightChange( long newValue )
        {
            return true;
        }

        /// <summary>
        /// 金币改变时后调用
        /// </summary>
        public virtual void OnAfterWeightChange( long oldValue )
        {
        }
        #endregion

        #region zh-CHS 共有方法 | en Public Methods
        /// <summary>
        /// 更新全部类型的数量
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="type"></param>
        /// <param name="delta"></param>
        public bool UpdateWeight( long newValue )
        {
            if ( newValue < 0 )
                return false;

            long oldValue = m_Weight;

            if ( OnGoldChange( newValue ) == false )
                return false;
            else
                m_Weight = newValue;

            GeneralItemDelta l_ItemDelta = ItemDelta as GeneralItemDelta;
            if ( l_ItemDelta == null )
                Debug.WriteLine( "GeneralMobile.UpdateWeight(...) - l_ItemDelta == null warning!" );
            else
            {
                l_ItemDelta.DeltaWeightUpdate();
                UpdateSlice();
            }

            OnAfterGoldChange( oldValue );

            return true;
        }
        #endregion

        #endregion

        #region zh-CHS Stackable属性 | en Public Properties

        #region zh-CHS 私有成员变量 | en Private Member Variables
        /// <summary>
        /// 
        /// </summary>
        private bool m_Stackable = false;
        #endregion
        /// <summary>
        /// 是否可以叠放
        /// </summary>
        [CommandProperty( AccessLevel.GameMaster )]
        public bool Stackable
        {
            get { return m_Stackable; }
            set { UpdateStackable( value ); }
        }

        #region zh-CHS 保护方法 | en Protected Methods
        /// <summary>
        /// 金币改变时调用
        /// </summary>
        public virtual bool OnStackableChange( bool newValue )
        {
            return true;
        }

        /// <summary>
        /// 金币改变时后调用
        /// </summary>
        public virtual void OnAfterStackableChange( bool oldValue )
        {
        }
        #endregion

        #region zh-CHS 共有方法 | en Public Methods
        /// <summary>
        /// 更新全部类型的数量
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="type"></param>
        /// <param name="delta"></param>
        public bool UpdateStackable( bool newValue )
        {
            bool oldValue = m_Stackable;

            if ( OnStackableChange( newValue ) == false )
                return false;
            else
                m_Stackable = newValue;

            GeneralItemDelta l_ItemDelta = ItemDelta as GeneralItemDelta;
            if ( l_ItemDelta == null )
                Debug.WriteLine( "GeneralMobile.UpdateStackable(...) - l_ItemDelta == null warning!" );
            else
            {
                l_ItemDelta.DeltaStackableUpdate();
                UpdateSlice();
            }

            OnAfterStackableChange( oldValue );

            return true;
        }
        #endregion

        #endregion

        #region zh-CHS DecayTime属性 | en Public Properties

        #region zh-CHS 私有成员变量 | en Private Member Variables
        /// <summary>
        /// 
        /// </summary>
        private TimeSpan m_DecayTime = m_DefaultDecayTime;
        #endregion
        /// <summary>
        /// 物品的消失时间
        /// </summary>
        [CommandProperty( AccessLevel.GameMaster )]
        public virtual TimeSpan DecayTime
        {
            get { return m_DecayTime; }
            set { UpdateDecayTime( value ); }
        }

        #region zh-CHS 保护方法 | en Protected Methods
        /// <summary>
        /// 金币改变时调用
        /// </summary>
        public virtual bool OnDecayTimeChange( TimeSpan newValue )
        {
            return true;
        }

        /// <summary>
        /// 金币改变时后调用
        /// </summary>
        public virtual void OnAfterDecayTimeChange( TimeSpan oldValue )
        {
        }
        #endregion

        #region zh-CHS 共有方法 | en Public Methods
        /// <summary>
        /// 更新全部类型的数量
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="type"></param>
        /// <param name="delta"></param>
        public bool UpdateDecayTime( TimeSpan newValue )
        {
            TimeSpan oldValue = m_DecayTime;

            if ( OnDecayTimeChange( newValue ) == false )
                return false;
            else
                m_DecayTime = newValue;

            GeneralItemDelta l_ItemDelta = ItemDelta as GeneralItemDelta;
            if ( l_ItemDelta == null )
                Debug.WriteLine( "GeneralMobile.UpdateDecayTime(...) - l_ItemDelta == null warning!" );
            else
            {
                l_ItemDelta.DeltaDecayTimeUpdate();
                UpdateSlice();
            }

            OnAfterDecayTimeChange( oldValue );

            return true;
        }
        #endregion

        #endregion

        #region zh-CHS Decays属性 | en Public Properties

        #region zh-CHS 私有成员变量 | en Private Member Variables
        /// <summary>
        /// 
        /// </summary>
        private bool m_Decays = false;
        #endregion
        /// <summary>
        /// 物品是否已经消失
        /// </summary>
        [CommandProperty( AccessLevel.GameMaster )]
        public virtual bool Decays
        {
            get { return ( m_Decays && this.Visible ); }
            set { UpdateDecays(value); }
        }

        #region zh-CHS 保护方法 | en Protected Methods
        /// <summary>
        /// 金币改变时调用
        /// </summary>
        public virtual bool OnDecaysChange( bool newValue )
        {
            return true;
        }

        /// <summary>
        /// 金币改变时后调用
        /// </summary>
        public virtual void OnAfterDecaysChange( bool oldValue )
        {
        }
        #endregion

        #region zh-CHS 共有方法 | en Public Methods
        /// <summary>
        /// 更新全部类型的数量
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="type"></param>
        /// <param name="delta"></param>
        public bool UpdateDecays( bool newValue )
        {
            bool oldValue = m_Stackable;

            if ( OnDecaysChange( newValue ) == false )
                return false;
            else
                m_Stackable = newValue;

            GeneralItemDelta l_ItemDelta = ItemDelta as GeneralItemDelta;
            if ( l_ItemDelta == null )
                Debug.WriteLine( "GeneralMobile.UpdateDecays(...) - l_ItemDelta == null warning!" );
            else
            {
                l_ItemDelta.DeltaDecaysUpdate();
                UpdateSlice();
            }

            OnAfterDecaysChange( oldValue );

            return true;
        }
        #endregion

        #endregion

        #endregion

        #region zh-CHS 人物的抗性属性 | en

        #region zh-CHS PhysicalResistance属性 | en Public Properties

        #region zh-CHS 私有成员变量 | en Private Member Variables
        /// <summary>
        /// 人物的全部抗性
        /// </summary>
        private long m_PhysicalResistance = 0;
        #endregion
        /// <summary>
        /// 自然抗性
        /// </summary>
        public virtual long PhysicalResistance
        {
            get { return m_PhysicalResistance; }
        }

        #region zh-CHS 保护方法 | en Protected Methods
        /// <summary>
        /// 金币改变时调用
        /// </summary>
        public virtual bool OnPhysicalResistanceChange( long newValue )
        {
            return true;
        }

        /// <summary>
        /// 金币改变时后调用
        /// </summary>
        public virtual void OnAfterPhysicalResistanceChange( long oldValue )
        {
        }
        #endregion

        #region zh-CHS 共有方法 | en Public Methods
        /// <summary>
        /// 更新全部类型的数量
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="type"></param>
        /// <param name="delta"></param>
        public bool UpdatePhysicalResistance( long newValue )
        {
            if ( newValue < 0 )
                return false;

            long oldValue = m_Gold;

            if ( OnPhysicalResistanceChange( newValue ) == false )
                return false;
            else
                m_Gold = newValue;

            GeneralItemDelta l_ItemDelta = ItemDelta as GeneralItemDelta;
            if ( l_ItemDelta == null )
                Debug.WriteLine( "GeneralMobile.UpdatePhysicalResistance(...) - l_ItemDelta == null warning!" );
            else
            {
                l_ItemDelta.DeltaPhysicalResistanceUpdate();
                UpdateSlice();
            }

            OnAfterPhysicalResistanceChange( oldValue );

            return true;
        }
        #endregion

        #endregion

        #region zh-CHS FireResistance属性 | en Public Properties

        #region zh-CHS 私有成员变量 | en Private Member Variables
        /// <summary>
        /// 人物的全部抗性
        /// </summary>
        private long m_FireResistance = 0;
        #endregion
        /// <summary>
        /// 火系抗性
        /// </summary>
        public virtual long FireResistance
        {
            get { return m_FireResistance; }
        }

        #region zh-CHS 保护方法 | en Protected Methods
        /// <summary>
        /// 金币改变时调用
        /// </summary>
        public virtual bool OnFireResistanceChange( long newValue )
        {
            return true;
        }

        /// <summary>
        /// 金币改变时后调用
        /// </summary>
        public virtual void OnAfterFireResistanceChange( long oldValue )
        {
        }
        #endregion

        #region zh-CHS 共有方法 | en Public Methods
        /// <summary>
        /// 更新全部类型的数量
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="type"></param>
        /// <param name="delta"></param>
        public bool UpdateFireResistance( long newValue )
        {
            if ( newValue < 0 )
                return false;

            long oldValue = m_Gold;

            if ( OnFireResistanceChange( newValue ) == false )
                return false;
            else
                m_Gold = newValue;

            GeneralItemDelta l_ItemDelta = ItemDelta as GeneralItemDelta;
            if ( l_ItemDelta == null )
                Debug.WriteLine( "GeneralMobile.UpdateFireResistance(...) - l_ItemDelta == null warning!" );
            else
            {
                l_ItemDelta.DeltaFireResistanceUpdate();
                UpdateSlice();
            }

            OnAfterFireResistanceChange( oldValue );

            return true;
        }
        #endregion

        #endregion

        #region zh-CHS ColdResistance属性 | en Public Properties

        #region zh-CHS 私有成员变量 | en Private Member Variables
        /// <summary>
        /// 人物的全部抗性
        /// </summary>
        private long m_ColdResistance = 0;
        #endregion
        /// <summary>
        /// 冰系抗性
        /// </summary>
        public virtual long ColdResistance
        {
            get { return m_ColdResistance; }
        }

        #region zh-CHS 保护方法 | en Protected Methods
        /// <summary>
        /// 金币改变时调用
        /// </summary>
        public virtual bool OnColdResistanceChange( long newValue )
        {
            return true;
        }

        /// <summary>
        /// 金币改变时后调用
        /// </summary>
        public virtual void OnAfterColdResistanceChange( long oldValue )
        {
        }
        #endregion

        #region zh-CHS 共有方法 | en Public Methods
        /// <summary>
        /// 更新全部类型的数量
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="type"></param>
        /// <param name="delta"></param>
        public bool UpdateColdResistance( long newValue )
        {
            if ( newValue < 0 )
                return false;

            long oldValue = m_Gold;

            if ( OnColdResistanceChange( newValue ) == false )
                return false;
            else
                m_Gold = newValue;

            GeneralItemDelta l_ItemDelta = ItemDelta as GeneralItemDelta;
            if ( l_ItemDelta == null )
                Debug.WriteLine( "GeneralMobile.UpdateColdResistance(...) - l_ItemDelta == null warning!" );
            else
            {
                l_ItemDelta.DeltaColdResistanceUpdate();
                UpdateSlice();
            }

            OnAfterColdResistanceChange( oldValue );

            return true;
        }
        #endregion

        #endregion

        #region zh-CHS PoisonResistance属性 | en Public Properties

        #region zh-CHS 私有成员变量 | en Private Member Variables
        /// <summary>
        /// 人物的全部抗性
        /// </summary>
        private long m_PoisonResistance = 0;
        #endregion
        /// <summary>
        /// 毒性抗性
        /// </summary>
        public virtual long PoisonResistance
        {
            get { return m_PoisonResistance; }
        }

        #region zh-CHS 保护方法 | en Protected Methods
        /// <summary>
        /// 金币改变时调用
        /// </summary>
        public virtual bool OnPoisonResistanceChange( long newValue )
        {
            return true;
        }

        /// <summary>
        /// 金币改变时后调用
        /// </summary>
        public virtual void OnAfterPoisonResistanceChange( long oldValue )
        {
        }
        #endregion

        #region zh-CHS 共有方法 | en Public Methods
        /// <summary>
        /// 更新全部类型的数量
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="type"></param>
        /// <param name="delta"></param>
        public bool UpdatePoisonResistance( long newValue )
        {
            if ( newValue < 0 )
                return false;

            long oldValue = m_Gold;

            if ( OnPoisonResistanceChange( newValue ) == false )
                return false;
            else
                m_Gold = newValue;

            GeneralItemDelta l_ItemDelta = ItemDelta as GeneralItemDelta;
            if ( l_ItemDelta == null )
                Debug.WriteLine( "GeneralMobile.UpdatePoisonResistance(...) - l_ItemDelta == null warning!" );
            else
            {
                l_ItemDelta.DeltaPoisonResistanceUpdate();
                UpdateSlice();
            }

            OnAfterPoisonResistanceChange( oldValue );

            return true;
        }
        #endregion

        #endregion

        #region zh-CHS EnergyResistance属性 | en Public Properties

        #region zh-CHS 私有成员变量 | en Private Member Variables
        /// <summary>
        /// 人物的全部抗性
        /// </summary>
        private long m_EnergyResistance = 0;
        #endregion
        /// <summary>
        /// 精力抗性
        /// </summary>
        public virtual long EnergyResistance
        {
            get { return m_EnergyResistance; }
        }

        #region zh-CHS 保护方法 | en Protected Methods
        /// <summary>
        /// 金币改变时调用
        /// </summary>
        public virtual bool OnEnergyResistanceChange( long newValue )
        {
            return true;
        }

        /// <summary>
        /// 金币改变时后调用
        /// </summary>
        public virtual void OnAfterEnergyResistanceChange( long oldValue )
        {
        }
        #endregion

        #region zh-CHS 共有方法 | en Public Methods
        /// <summary>
        /// 更新全部类型的数量
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="type"></param>
        /// <param name="delta"></param>
        public bool UpdateEnergyResistance( long newValue )
        {
            if ( newValue < 0 )
                return false;

            long oldValue = m_Gold;

            if ( OnEnergyResistanceChange( newValue ) == false )
                return false;
            else
                m_Gold = newValue;

            GeneralItemDelta l_ItemDelta = ItemDelta as GeneralItemDelta;
            if ( l_ItemDelta == null )
                Debug.WriteLine( "GeneralMobile.UpdateEnergyResistance(...) - l_ItemDelta == null warning!" );
            else
            {
                l_ItemDelta.DeltaEnergyResistanceUpdate();
                UpdateSlice();
            }

            OnAfterEnergyResistanceChange( oldValue );

            return true;
        }
        #endregion

        #endregion

        #endregion

        #region zh-CHS 静态属性 | en Static Properties

        #region zh-CHS 私有成员变量 | en Private Member Variables
        /// <summary>
        /// 道具缺省的消失时间
        /// </summary>
        private static TimeSpan m_DefaultDecayTime = TimeSpan.FromHours( 1.0 );
        #endregion
        /// <summary>
        /// 道具缺省的消失时间
        /// </summary>
        public static TimeSpan DefaultDecayTime
        {
            get { return m_DefaultDecayTime; }
            set { m_DefaultDecayTime = value; }
        }

        #endregion

        #region zh-CHS 装备是否消失方法 | en Public Methods

        /// <summary>
        /// 是否已消失
        /// </summary>
        /// <returns></returns>
        public virtual bool OnDecay()
        {
            //return ( Decays && Parent == null && Region.Find( Location, Map ).OnDecay( this ) );
            return ( Decays /* && Parent == null */  );
        }

        #endregion

        #region zh-CHS 方法覆盖 | en Override Methods
        /// <summary>
        /// 
        /// </summary>
        protected void ProcessDelta()
        {
            //ItemDelta flags = m_DeltaFlags;

            //SetFlag( ImplFlag.InQueue, false );
            //m_DeltaFlags = ItemDelta.None;

            //BaseMap map = m_Map;

            //if ( map != null && !Deleted )
            //{
            //    bool sendOPLUpdate = ObjectPropertyList.Enabled && (flags & ItemDelta.Properties) != 0;

            //    Container contParent = m_Parent as Container;

            //    if ( contParent != null && !contParent.IsPublicContainer )
            //    {
            //        if ( (flags & ItemDelta.Update) != 0 )
            //        {
            //            Packet p = null;
            //            Point3D worldLoc = GetWorldLocation();

            //            BaseMobile rootParent = contParent.RootParent as BaseMobile;
            //            BaseMobile tradeRecip = null;

            //            if ( rootParent != null )
            //            {
            //                NetState ns = rootParent.NetState;

            //                if ( ns != null )
            //                {
            //                    if ( rootParent.CanSee( this ) && rootParent.InRange( worldLoc, GetUpdateRange( rootParent ) ) )
            //                    {
            //                        if ( p == null )
            //                            p = Packet.Acquire( new ContainerContentUpdate( this ) );

            //                        ns.Send( p );

            //                        if ( ObjectPropertyList.Enabled )
            //                            ns.Send( OPLPacket );
            //                    }
            //                }
            //            }

            //            SecureTradeContainer stc = this.GetSecureTradeCont();

            //            if ( stc != null )
            //            {
            //                SecureTrade st = stc.Trade;

            //                if ( st != null )
            //                {
            //                    BaseMobile test = st.From.BaseMobile;

            //                    if ( test != null && test != rootParent )
            //                        tradeRecip = test;

            //                    test = st.To.BaseMobile;

            //                    if ( test != null && test != rootParent )
            //                        tradeRecip = test;

            //                    if ( tradeRecip != null )
            //                    {
            //                        NetState ns = tradeRecip.NetState;

            //                        if ( ns != null )
            //                        {
            //                            if ( tradeRecip.CanSee( this ) && tradeRecip.InRange( worldLoc, GetUpdateRange( tradeRecip ) ) )
            //                            {
            //                                if ( p == null )
            //                                    p = Packet.Acquire( new ContainerContentUpdate( this ) );

            //                                ns.Send( p );

            //                                if ( ObjectPropertyList.Enabled )
            //                                    ns.Send( OPLPacket );
            //                            }
            //                        }
            //                    }
            //                }
            //            }

            //            List<BaseMobile> openers = contParent.Openers;

            //            if ( openers != null )
            //            {
            //                for ( int i = 0; i < openers.Count; ++i )
            //                {
            //                    BaseMobile mob = openers[i];

            //                    int range = GetUpdateRange( mob );

            //                    if ( mob.Map != map || !mob.InRange( worldLoc, range ) )
            //                    {
            //                        openers.RemoveAt( i-- );
            //                    }
            //                    else
            //                    {
            //                        if ( mob == rootParent || mob == tradeRecip )
            //                            continue;

            //                        NetState ns = mob.NetState;

            //                        if ( ns != null )
            //                        {
            //                            if ( mob.CanSee( this ) )
            //                            {
            //                                if ( p == null )
            //                                    p = Packet.Acquire( new ContainerContentUpdate( this ) );

            //                                ns.Send( p );

            //                                if ( ObjectPropertyList.Enabled )
            //                                    ns.Send( OPLPacket );
            //                            }
            //                        }
            //                    }
            //                }

            //                if ( openers.Count == 0 )
            //                    contParent.Openers = null;
            //            }

            //            Packet.Release( p );

            //            return;
            //        }
            //    }

            //    if ( (flags & ItemDelta.Update) != 0 )
            //    {
            //        Packet p = null;
            //        Point3D worldLoc = GetWorldLocation();

            //        IPooledEnumerable eable = map.GetClientsInRange( worldLoc, GetMaxUpdateRange() );

            //        foreach ( NetState state in eable ) {
            //            BaseMobile m = state.BaseMobile;

            //            if ( m.CanSee( this ) && m.InRange( worldLoc, GetUpdateRange( m ) ) ) {
            //                if ( m_Parent == null ) {
            //                    SendInfoTo( state, ObjectPropertyList.Enabled );
            //                } else {
            //                    if ( p == null ) {
            //                        if ( m_Parent is BaseItem ) {
            //                            p = new ContainerContentUpdate( this );
            //                        } else if ( m_Parent is BaseMobile ) {
            //                            p = new EquipUpdate( this );
            //                        }

            //                        p.Acquire();
            //                    }

            //                    state.Send( p );

            //                    if ( ObjectPropertyList.Enabled ) {
            //                        state.Send( OPLPacket );
            //                    }
            //                }
            //            }
            //        }

            //        Packet.Release( p );

            //        eable.Free();
            //        sendOPLUpdate = false;
            //    }
            //    else if ( (flags & ItemDelta.EquipOnly ) != 0 )
            //    {
            //        if ( m_Parent is BaseMobile )
            //        {
            //            Packet p = null;
            //            Point3D worldLoc = GetWorldLocation();

            //            IPooledEnumerable eable = map.GetClientsInRange( worldLoc, GetMaxUpdateRange() );

            //            foreach ( NetState state in eable )
            //            {
            //                BaseMobile m = state.BaseMobile;

            //                if ( m.CanSee( this ) && m.InRange( worldLoc, GetUpdateRange( m ) ) )
            //                {
            //                    //if ( sendOPLUpdate )
            //                    //	state.Send( RemovePacket );

            //                    if ( p == null )
            //                        p = Packet.Acquire( new EquipUpdate( this ) );

            //                    state.Send( p );

            //                    if ( ObjectPropertyList.Enabled )
            //                        state.Send( OPLPacket );
            //                }
            //            }

            //            Packet.Release( p );

            //            eable.Free();
            //            sendOPLUpdate = false;
            //        }
            //    }

            //    if ( sendOPLUpdate )
            //    {
            //        Point3D worldLoc = GetWorldLocation();
            //        IPooledEnumerable eable = map.GetClientsInRange( worldLoc, GetMaxUpdateRange() );

            //        foreach ( NetState state in eable )
            //        {
            //            BaseMobile m = state.BaseMobile;

            //            if ( m.CanSee( this ) && m.InRange( worldLoc, GetUpdateRange( m ) ) )
            //                state.Send( OPLPacket );
            //        }

            //        eable.Free();
            //    }
            //}
        }
        #endregion









        #region zh-CHS 私有静态成员变量 | en Private Static Member Variables
        /// <summary>
        /// 道具的的状态
        /// </summary>
        private IItemDelta m_BaseItemState = null;
        #endregion
        /// <summary>
        /// 道具的的状态
        /// </summary>
        public IItemDelta ItemDelta
        {
            get { return m_BaseItemState; }
        }

        #region zh-CHS Visible属性 | en Public Properties

        #region zh-CHS 私有成员变量 | en Private Member Variables
        /// <summary>
        /// 
        /// </summary>
        private bool m_Visible = true;
        #endregion
        /// <summary>
        /// 是否可见
        /// </summary>
        public bool Visible
        {
            get { return m_Visible; }
            set
            {
            }
        }

        #endregion

        #region zh-CHS IsVirtualItem属性 | en Public Properties

        #region zh-CHS 私有静态成员变量 | en Private Static Member Variables
        /// <summary>
        /// 
        /// </summary>
        private bool m_IsVirtualItem = false;
        #endregion
        /// <summary>
        /// 是否是不可见的道具
        /// </summary>
        public virtual bool IsVirtualItem
        {
            get { return m_IsVirtualItem; }
            set
            {
                //UpdateItem( UpdateBaseItemValue.IsVirtualItem, value );
            }
        }

        #endregion

        #region zh-CHS Layer属性 | en Public Properties

        #region zh-CHS 私有静态成员变量 | en Private Static Member Variables
        /// <summary>
        /// 
        /// </summary>
        private Layer m_Layer = Layer.Waist;
        #endregion
        /// <summary>
        /// 道具使用在身体上的部位
        /// </summary>
        [CommandProperty( AccessLevel.GameMaster )]
        public virtual Layer Layer
        {
            get { return m_Layer; }
            set
            {
                //UpdateItem( UpdateBaseItemValue.Layer, value );
            }
        }

        #endregion


        ///// <summary>
        ///// 在身上找道具
        ///// </summary>
        ///// <param name="layer"></param>
        ///// <returns></returns>
        //public BaseItem[] FindChildItemOnLayer( Layer layer )
        //{
        //    List<BaseItem> l_BaseItem = new List<BaseItem>();

        //    ReaderWriterLockSlimEx.EnterWriteLock( m_LockChildItems );
        //    {
        //        foreach ( KeyValuePair<long, BaseItem> Item in m_ChildItems )
        //        {
        //            if ( Item.Value.Deleted == false && Item.Value.Layer == layer )
        //                l_BaseItem.Add( Item.Value );
        //        }
        //    }
        //    ReaderWriterLockSlimEx.ExitWriteLock( m_LockChildItems );

        //    return l_BaseItem.ToArray();
        //}


        #region zh-CHS ISpawner属性 | en Public Properties
        #region zh-CHS 私有静态成员变量 | en Private Static Member Variables
        /// <summary>
        /// 
        /// </summary>
        private ISpawner m_Spawner = null;
        #endregion
        /// <summary>
        /// 
        /// </summary>
        public ISpawner Spawner
        {
            get { return m_Spawner; }
            set { m_Spawner = value; }
        }
        #endregion


    }
}

